/*
 * Copyright 2017 Huawei Technologies Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.openo.sdno.lcm.dispatcher;

import java.util.List;
import org.openo.sdno.lcm.model.workplan.WorkPlan;
import org.openo.sdno.lcm.model.workplan.WorkPlanExecutionResult;
import org.openo.sdno.lcm.model.workplan.WorkPlanExecutionStrategy;

public interface Dispatcher {

    /**
     * Dispatcher executes the work plan generated by Decomposer and returns the execution results
     * Notes:
     * Work plan specifies the order of the tasks to be executed. It also contains all information
     * needed to fulfil each task so that Dispatcher can be independent from other modules.
     *
     * @param plan the work plan generated by Decomposer and to be executed by the Dispatcher
     * @param strategy the strategy followed by the Dispatcher when one work item fails.
     * @return the results of executing the whole plan. It also contains the result for each task.
     */
    WorkPlanExecutionResult dispatch(final WorkPlan plan, final WorkPlanExecutionStrategy strategy);

}
